package cn.wx.scholar.core.service;


import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.wx.scholar.core.entity.TxtFiles;
import cn.wx.common.persistence.base.BaseService;
import cn.wx.scholar.core.mapper.TxtFilesMapper;
import cn.wx.common.persistence.exception.MyException;
import cn.wx.common.persistence.web.ResponseCode;


/**
 * <p>
 *  服务类
 * </p>
 *
 * @author  
 * @since 2018-09-17
 */
@Service
@Transactional
public class TxtFilesService extends BaseService<TxtFiles, TxtFilesMapper> {

	public TxtFiles findOneCanRead(Integer unitId) {
		return super.simpleMapper.findOneCanRead(unitId);
	}
	
	 /**
	 * 修改
	 * @param txtFiles
	 * @return
	 * @throws MyException 
	 */
	public boolean modify(TxtFiles txtFiles) throws MyException{
		// PID 不能为空
		if (txtFiles.getpId() == null) {
			throw new MyException(ResponseCode.PARAMETER_REQUIRED);
		}
		return update(txtFiles);
	}

}
